package com.qifan.energy.fragment;

import android.view.View;

import com.qifan.energy.R;
import com.qifan.energy.activity.BalanceActivity;
import com.qifan.energy.activity.EnergyTreeActivity;
import com.qifan.energy.base.BaseFragment;
import com.qifan.energy.mvp.callback.IEventIndexCallback;
import com.qifan.energy.util.IntentUtils;
import com.qifan.energy.util.ToastUtils;
import com.qifan.energy.util.UIUtils;
import com.qifan.energy.widget.dialog.TaskBottomDialog;

import butterknife.OnClick;

public class TreeFragment extends BaseFragment {

    /*
    * 背景音乐（参考）
    * https://www.tukuppt.com/muban/lmnobbop.html
    *  */

    public static TreeFragment newInstance() {
        return new TreeFragment();
    }

    @Override
    public int getLayoutId() {
        return R.layout.fragment_tree;
    }

    @Override
    protected void initView(View view) {
        /*UIUtils.getHandler().postDelayed(()->{
            hideStatusAndResetFullScreen();
        },1000);*/
    }

    @Override
    public void initData() {
        //注册EventBus
        //EventBusUtils.register(this);
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        //注销EventBus
        //EventBusUtils.unregister(this);
    }

    /**
     * 接收到分发的事件
     */
    /*@Subscribe(threadMode = ThreadMode.MAIN)
    public void onMessageEvent(EventMessage event) {
        if (event.getCode() == EventCode.EVENT_1) {
            //cartList();
        }
    }*/

    @OnClick(R.id.lottery_iv)
    void onLotteryIvClicked(){
        ToastUtils.showShort("抽奖");
    }

    @OnClick(R.id.task_iv)
    void onTaskIvClicked(){
        new TaskBottomDialog()
                .showNow2(getParentFragmentManager(),"share")
                .setEventCallback(new IEventIndexCallback() {
                    @Override
                    public void onCancel() {
                        ToastUtils.showShort("关闭");
                    }

                    @Override
                    public void onComfirm(int index) {
                        ToastUtils.showShort("确定" + index);
                    }
                });
    }


    @OnClick(R.id.water_iv)
    void onWaterIvClicked(){
        ToastUtils.showShort("浇水");
    }

    @OnClick(R.id.bonus_gold_ll)
    void onBonusGoldLlClicked(){
        ToastUtils.showShort("分红金");
    }

    @OnClick({R.id.left_bonustree_ll})
    void onBonustreeLlClicked(){
        IntentUtils.startActivity(getActivity(), EnergyTreeActivity.class);
    }

    @OnClick({R.id.exchange_bonus_ll})
    void onExchangeBonusLlClicked(){
        ToastUtils.showShort("兑换~~~！");
    }

    @OnClick({R.id.yestodaybonus_ll})
    void onYestodaybonusLlClicked(){
        ToastUtils.showShort("昨日分红");
    }

    @OnClick({R.id.taskjifen_ll})
    void onEnergytreeLlClicked(){
        ToastUtils.showShort("任务积分");
    }
}
